<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>

	
		<title>My JSP 'write_Article.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	</head>
	<body>
	<h1>分类管理</h1>
	<hr>
	<a href="${pageContext.request.contextPath}/admin">返回管理</a>
	<html:form action="/admin/categories" method="post">
		<table width="655" border="1">
			
				<tr>
					<td width="232">
						新增博客分类 输入类别名称:
					</td>
					<td colspan="3">
						<html:text property="name"></html:text>
					</td>
				</tr>
				<tr>
					<td>
						输入类别描述：
					</td>

					<td colspan="3">
						<html:text property="description"></html:text>

						<input type="hidden" name="method" value="save" />
						<input type="submit" value="提交" />
					</td>
				</tr>
					
			
			<tr>
				<td>
					名称
				</td>
				<td width="94">
					文章数量
				</td>
				<td width="192">
					管理
				</td>
				<td width="109">
					排序
				</td>

			</tr>
			<c:forEach items="${categories}" var="catg">
				<tr>
					<td>
						<a href="${pageContext.request.contextPath}/admin/categories/${catg.id }" >${catg.name }</a>
					</td>
					<td>
						${catg.contains}
					</td>
					<td>
						<a href="#${catg.id }">编辑</a>&nbsp;&nbsp;
						
						 <a href="${pageContext.request.contextPath}/admin/categories/${catg.id }"  onclick="if (confirm('你确定要删除这个分类吗？')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f);f.name='categoryForm' ;f.method = 'POST'; f.action =this.href ;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'method'); m.setAttribute('value', 'delete'); f.appendChild(m); f.submit(); };return false;"
						 >删除</a>
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
			</c:forEach>
		</table>
</html:form>
	</body>
</html>
